<template>
    <div id="ecard-add">
        <tinymce :height="300" :width="600" v-model="cooperationPartner"></tinymce>
        <el-button type="primary" size="small" @click="setPartner()">确定</el-button>
    </div>
</template>

<script>
	import Tinymce from '@/components/Tinymce'
	import { getPartner, setPartner } from '@/api/cooperationPartner'
	import { Message } from 'element-ui'
	export default {
		components: {
			'tinymce': Tinymce
		},
		data() {
			return {
				fileUpload: process.env.BASE_API + '/files/upload',
				cooperationPartner: ''
			}
		},
		created() {
			// 获取合作商家
			this.getPartner()
		},
		methods: {
			getPartner() {
				getPartner().then(res => {
					let data = res.data
					if (data.errorCode === 'E_000') {
						this.cooperationPartner = data.body.content
					}
				})
			},
			setPartner() {
				let params = {
					content: this.cooperationPartner
                }
				setPartner(params).then(res => {
					let data = res.data
					if (data.errorCode === 'E_000') {
						Message({
							message: data.message,
							type: 'success',
							duration: 2 * 1000
						})
					}
				})
			}
		}
	}
</script>
<style rel="stylesheet/scss" lang="scss">
    #ecard-add{
        .tinymce-container{
            width: 1000px;
            margin-bottom: 30px;
        }
    }
</style>
